/*
 * $Id: qtcQMainWindow.cpp 7 2010-11-07 09:07:07Z tfonrouge $
 */

#include "qtharbour.h"

#include "qmainwindow.h"
#include <QPushButton>

HB_FUNC( QMAINWINDOW_NEW )
{
    xho_ObjParams objParams = xho_ObjParams( NULL );
    
    QWidget* parent = (QWidget *) objParams.paramParent( 1 );
    Qt::WindowFlags flags = (Qt::WindowFlags) hb_parni( 2 );
    
    QPointer<QMainWindow> mainWindow = new QMainWindow( parent, flags );
    
    objParams.Return( mainWindow );
}

/* <QTH_GEN> */
HB_FUNC( QMAINWINDOW_ADDDOCKWIDGET )
{
    QMainWindow* mainWindow = (QMainWindow *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( mainWindow )
    {
        if( hb_pcount() == 2 )
        {
            mainWindow->addDockWidget( (Qt::DockWidgetArea) hb_parni( 1 ), (QDockWidget *) xho_par_XhoObject( 2 ) );
            return;
        }
        if( hb_pcount() == 3 )
        {
            mainWindow->addDockWidget( (Qt::DockWidgetArea) hb_parni( 1 ), (QDockWidget *) xho_par_XhoObject( 2 ), (Qt::Orientation) hb_parni( 3 ) );
            return;
        }
    }
}

HB_FUNC( QMAINWINDOW_ADDTOOLBAR )
{
    QMainWindow* mainWindow = (QMainWindow *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( mainWindow )
    {
        if( HB_ISCHAR( 1 ) )
        {
            xho_itemReturn( (QObject *) mainWindow->addToolBar( qth_parc( 1 ) ) );
            return;
        }
        if( hb_pcount() == 2 )
        {
            mainWindow->addToolBar( (Qt::ToolBarArea) hb_parni( 1 ), (QToolBar *) xho_par_XhoObject( 2 ) );
            return;
        }
        if( hb_pcount() == 1 )
        {
            mainWindow->addToolBar( (QToolBar *) xho_par_XhoObject( 1 ) );
            return;
        }
    }
}

HB_FUNC( QMAINWINDOW_ADDTOOLBARBREAK )
{
    QMainWindow* mainWindow = (QMainWindow *) xho_itemListGet_XHO( hb_stackSelfItem() );

    if( mainWindow )
    {
        if( hb_pcount() == 0 )
        {
            mainWindow->addToolBarBreak();
            return;
        }
        if( hb_pcount() > 0 )
        {
            mainWindow->addToolBarBreak( (Qt::ToolBarArea) hb_parni( 1 ) );
            return;
        }
    }
}

/* </QTH_GEN> */
